package com.corechina.apex_osswords.controller;


import com.corechina.apex_osswords.common.Response;
import com.corechina.apex_osswords.domain.dto.CoreVisitingRecordsDto;
import com.corechina.apex_osswords.service.ICoreVisitingRecordsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 来访日志 前端控制器
 * </p>
 *
 * @author cc
 * @since 2022-05-30
 */

@Api(tags = "来访日志")
@RestController
@RequestMapping("/core/visitingRecords")
public class CoreVisitingRecordsController {

    @Autowired
    private ICoreVisitingRecordsService iCoreVisitingRecordsService;

    @ApiOperation("新增访客记录")
    @PostMapping("/add")
    public Response add(@RequestBody CoreVisitingRecordsDto coreVisitingRecordsDto) {
        return iCoreVisitingRecordsService.add(coreVisitingRecordsDto);
    }

    @ApiOperation("来访日志列表")
    @GetMapping("/getList")
    public Response getList(Integer placeId, String company, String visitorName, String visitingTimeBegin, String visitingTimeEnd, String departureTimeBegin, String departureTimeEnd, Integer pageIndex, Integer pageSize) {
        return iCoreVisitingRecordsService.getList(placeId, company, visitorName, visitingTimeBegin, visitingTimeEnd, departureTimeBegin, departureTimeEnd, pageIndex, pageSize);
    }

    @ApiOperation("来访日志详情")
    @GetMapping("/getOne")
    public Response getOne(Integer id) {
        return iCoreVisitingRecordsService.getOne(id);
    }

    @ApiOperation("来访统计")
    @GetMapping("/getVisitingStatistics")
    public Response getVisitingStatistics(Integer placeId, String visitingTimeBegin, String visitingTimeEnd) {
        return iCoreVisitingRecordsService.getVisitingStatistics(placeId, visitingTimeBegin, visitingTimeEnd);
    }
}

